Conventionally, there has been a device having a display unit that is openable, closable, and rotatable with respect to a device body in a digital camera, a video camera, and the like. The device performs inversion processing of an image displayed on the display unit in vertical and horizontal directions according to an opening and closing state or a rotating state of the display unit, and performs switching processing between turning on and turning off of a light. Additionally, a magnet and a magnetic sensor are used for detecting the opening and closing or the rotation of the display unit. This is because this can save a space and improve non-contact reliability. In Patent Literature 1, a device that uses the magnetic sensor for detecting each of the opening and closing and the rotation and then switching a display state of the display unit is disclosed.